package org.example;

import com.example.codec.CodecLocator;
import com.example.codec.CodecSet;

import java.util.ServiceLoader;

public class Demo {

	public static void main(String[] args) throws Exception {

		ServiceLoader<CodecSet> sets  = ServiceLoader.load(CodecSet.class);
		for(CodecSet set : sets){
			System.out.println(set.getDecoder());
		}
		CodecLocator locator = new CodecLocator();
		System.out.println(locator.getCodecSet("US-ASCII").getClass().getName());
    	System.out.println(locator.getCodecSet("UTF-8").getClass().getName());
	}
	
}
